<?php

class Pictures_Image_DisplaySuccessView extends BlogPicturesBaseView
{
	/**
	 * Display image.
	 *
	 * @param AgaviRequestDataHolder $rd
	 */
	public function executeImage(AgaviRequestDataHolder $rd)
	{
	    /* @var $model Pictures_PicturesModel */
	    $model = $this->getContext()->getModel('Pictures', 'Pictures');
	    $picture = $this->getAttribute('picture');
	    try {
	       list($content_type, $data, $last_modified) = $model->getPictureData($picture);
	    } catch (WereWordException $e) {
	        $this->setRoutingRedirect('no_image_box');
	        return '';
	    }
	    
	    $this->getResponse()->setContentType($content_type);
	    $this->getResponse()->setHttpHeader('Last-Modified', gmdate(DATE_RFC822, $last_modified));
	    return $data;
	}
}

?>